import Mock from 'mockjs'
export default {
  getTeacher: config => {
    console.log(config.body)
    const { username, password } = JSON.parse(config.body)
    console.log(username, password)
    if (username === 'teacher' && password === 'teacher') {
      return {
        status: 200,
        message: '登录成功',
        token: Mock.Random.guid(),
        menu: [
          {
            path: '/home',
            name: 'home',
            label: '首页',
            icon: 's-home',
            url: 'Home.vue'
          },
          {
            path: '/apply',
            name: 'apply',
            label: '支教报名',
            icon: 'video-play',
            url: 'Apply.vue'
          },
          {
            path: '/record',
            name: 'record',
            label: '服务记录',
            icon: 'user',
            url: 'Record.vue'
          },
          {
            path: '/share',
            name: 'share',
            label: '信息分享',
            icon: 'user',
            url: 'Share.vue'
          },
          {
            label: '个人信息',
            icon: 'location',
            children: [
              {
                path: '/information',
                name: 'information',
                label: '个人中心',
                icon: 'setting',
                url: 'Information.vue'
              },
              {
                path: '/comment',
                name: 'comment',
                label: '我的评论',
                icon: 'setting',
                url: 'Comment.vue'
              }
            ]
          }
        ]

      }
    } else {
      return {
        status: 999,
        message: '登录失败'
      }
    }
  },
  getSchool: (config) => {
    const { username, password } = JSON.parse(config.body)
    if (username === 'school' && password === 'school') {
      return {
        status: 200,
        message: '登录成功',
        token: Mock.Random.guid(),
        menu: [
          {
            path: '/home',
            name: 'home',
            label: '首页',
            icon: 's-home',
            url: 'Home.vue'
          },
          {
            path: '/publish',
            name: 'publish',
            label: '信息发布',
            icon: 'video-play',
            url: 'Publish.vue'
          },
          {
            path: '/teacherTab',
            name: 'teacherTab',
            label: '教师管理',
            icon: 'user',
            url: 'TeacherTab.vue'
          },
          {
            path: '/texa',
            name: 'texa',
            label: '报名审核',
            icon: 'user',
            url: 'Texa.vue'
          },
          {
            path: '/share',
            name: 'share',
            label: '信息分享',
            icon: 'user',
            url: 'Share.vue'
          },
          {
            path: '/schoolInfo',
            name: 'schoolInfo',
            label: '学校信息',
            icon: 'user',
            url: 'SchoolInfo.vue'
          }

        ]
      }
    } else {
      return {
        status: 999,
        message: '登录失败'
      }
    }
  },
  getManager: (config) => {
    const { username, password } = JSON.parse(config.body)
    if (username === 'admin' && password === 'admin') {
      return {
        status: 200,
        message: '登录成功',
        token: Mock.Random.guid(),
        menu: [
          {
            path: '/home',
            name: 'home',
            label: '首页',
            icon: 's-home',
            url: 'Home.vue'
          },
          {
            path: '/schoolTab',
            name: 'schoolTab',
            label: '学校管理',
            icon: 'video-play',
            url: 'SchoolTab.vue'
          },
          {
            path: '/teacherTab',
            name: 'teacherTab',
            label: '教师管理',
            icon: 'user',
            url: 'TeacherTab.vue'
          },
          {
            path: '/aexa',
            name: 'aexa',
            label: '活动审核',
            icon: 'user',
            url: 'Aexa.vue'
          },
          {
            path: '/record',
            name: 'record',
            label: '记录管理',
            icon: 'user',
            url: 'Record.vue'
          },
          {
            path: '/share',
            name: 'share',
            label: '信息分享',
            icon: 'user',
            url: 'Share.vue'
          },
          {
            path: '/dataCount',
            name: 'dataCount',
            label: '数据统计',
            icon: 'user',
            url: 'DataCount.vue'
          }

        ]
      }
    } else {
      return {
        status: 999,
        message: '登录失败'
      }
    }
  }
}
